home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / rcp / tmp < prev   
Encoding:
Text File  |  1993-01-03  |  35.4 KB  |  4,509 lines

  1. # 1 "rcp.c"
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36. char copyright[] =
  37. "@(#) Copyright (c) 1983, 1990 The Regents of the University of California.\n\
  38.  All rights reserved.\n";
  39.  
  40.  
  41.  
  42. static char sccsid[] = "@(#)rcp.c    5.32 (Berkeley) 2/25/91";
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. # 1 "/sprite/lib/include/sys/param.h"
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76. # 1 "/sprite/lib/include/sys/types.h"
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111. typedef    unsigned char    u_char;
  112. typedef    unsigned short    u_short;
  113. typedef    unsigned int    u_int;
  114. typedef    unsigned long    u_long;
  115. typedef    unsigned short    ushort;        
  116.  
  117. # 46 "/sprite/lib/include/sys/types.h"
  118.  
  119. # 52 "/sprite/lib/include/sys/types.h"
  120.  
  121.  
  122.  
  123. typedef struct  _physadr { int r[1]; } *physadr;
  124. typedef struct  label_t {
  125.         int     val[12];
  126. } label_t;
  127.  
  128.  
  129.  
  130.  
  131.  
  132. typedef struct _quad {long val[2]; } quad;
  133. typedef    struct    _uquad {unsigned long val[2]; } u_quad;
  134.  
  135. typedef    long    daddr_t;
  136. typedef    char *    caddr_t;
  137. typedef    long *    qaddr_t;    
  138. typedef    u_long    ino_t;
  139. typedef    long    swblk_t;
  140.  
  141.  
  142. typedef    unsigned short  mode_t;
  143.  
  144.  
  145.  
  146. typedef    int    size_t;
  147.  
  148.  
  149.  
  150. typedef    long    time_t;
  151.  
  152.  
  153.  
  154. typedef    long    clock_t;
  155.  
  156. typedef    short    dev_t;
  157. typedef    long    off_t;
  158. typedef    short    uid_t;
  159. typedef    short    gid_t;
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167. typedef int    pid_t;
  168.  
  169. typedef long    key_t;        
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182. typedef long    fd_mask;
  183.  
  184.  
  185.  
  186.  
  187.  
  188. typedef    struct fd_set {
  189.     fd_mask    fds_bits[    (((256)+(( (sizeof(fd_mask) * 8        )    )-1))/( (sizeof(fd_mask) * 8        )    ))];
  190. } fd_set;
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198. # 27 "/sprite/lib/include/sys/param.h"
  199.  
  200. # 1 "/sprite/lib/include/signal.h"
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214. # 1 "/sprite/lib/include/cfuncproto.h"
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255. # 44 "/sprite/lib/include/cfuncproto.h"
  256.  
  257.  
  258. # 52 "/sprite/lib/include/cfuncproto.h"
  259.  
  260.  
  261.  
  262.  
  263.  
  264. # 59 "/sprite/lib/include/cfuncproto.h"
  265.  
  266.  
  267.  
  268.  
  269. # 65 "/sprite/lib/include/cfuncproto.h"
  270.  
  271.  
  272.  
  273.  
  274. # 71 "/sprite/lib/include/cfuncproto.h"
  275.  
  276. typedef char *_VoidPtr;
  277.  
  278.  
  279.  
  280.  
  281.  
  282. # 14 "/sprite/lib/include/signal.h"
  283.  
  284. # 1 "/sprite/lib/include/machSignal.h"
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312. struct    sigcontext {
  313.     int    sc_onstack;        
  314.     int    sc_mask;        
  315.     int    sc_pc;            
  316.     
  317.  
  318.  
  319.     int    sc_regs[32];    
  320.     int    sc_mdlo;    
  321.     int    sc_mdhi;    
  322.     
  323.  
  324.  
  325.     int    sc_ownedfp;    
  326.     int    sc_fpregs[32];    
  327.     int    sc_fpc_csr;    
  328.     int    sc_fpc_eir;    
  329.     
  330.  
  331.  
  332.  
  333.     
  334.  
  335.  
  336.     int    sc_cause;    
  337.     int    sc_badvaddr;    
  338.     int    sc_badpaddr;    
  339. };
  340.  
  341. # 15 "/sprite/lib/include/signal.h"
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393. extern void (*signal 
  394.     ())     ();
  395.  
  396. extern int sigblock     ();
  397. extern int sigpause     ();
  398. extern int sigsetmask     ();
  399.  
  400.  
  401.  
  402.  
  403.  
  404. struct    sigvec {
  405.     void    (*sv_handler)();    
  406.     int    sv_mask;        
  407.     int    sv_flags;        
  408. };
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416. struct    sigstack {
  417.     char    *ss_sp;            
  418.     int    ss_onstack;        
  419. };
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431. # 117 "/sprite/lib/include/signal.h"
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438. # 126 "/sprite/lib/include/signal.h"
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448. # 28 "/sprite/lib/include/sys/param.h"
  449.  
  450. # 1 "/sprite/lib/include/machparam.h"
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489. # 1 "/sprite/lib/include/machine/limits.h"
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578. # 39 "/sprite/lib/include/machparam.h"
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618. # 29 "/sprite/lib/include/sys/param.h"
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693. # 48 "rcp.c"
  694.  
  695. # 1 "/sprite/lib/include/sys/stat.h"
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709. # 1 "/sprite/lib/include/cfuncproto.h"
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743. # 76 "/sprite/lib/include/cfuncproto.h"
  744.  
  745.  
  746. # 14 "/sprite/lib/include/sys/stat.h"
  747.  
  748. struct    stat
  749. {
  750.     dev_t    st_dev;
  751.     ino_t    st_ino;
  752.     unsigned short st_mode;
  753.     short    st_nlink;
  754.     uid_t    st_uid;
  755.     gid_t    st_gid;
  756.     dev_t    st_rdev;
  757.     off_t    st_size;
  758.     time_t    st_atime;
  759.     int    st_spare1;
  760.     time_t    st_mtime;
  761.     int    st_spare2;
  762.     time_t    st_ctime;
  763.     int    st_spare3;
  764.     long    st_blksize;
  765.     long    st_blocks;
  766.     long    st_serverID;
  767.     long    st_version;
  768.     long    st_userType;
  769.     long    st_devServerID;
  770. };
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826. extern int fstat     ();
  827. extern int lstat     ();
  828. extern int stat     ();
  829.  
  830. extern int mkdir     ();
  831.  
  832.  
  833. # 49 "rcp.c"
  834.  
  835. # 1 "/sprite/lib/include/sys/time.h"
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849. # 1 "/sprite/lib/include/cfuncproto.h"
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883. # 76 "/sprite/lib/include/cfuncproto.h"
  884.  
  885.  
  886. # 14 "/sprite/lib/include/sys/time.h"
  887.  
  888.  
  889.  
  890.  
  891.  
  892. struct timeval {
  893.     long    tv_sec;        
  894.     long    tv_usec;    
  895. };
  896.  
  897. struct timezone {
  898.     int    tz_minuteswest;    
  899.     int    tz_dsttime;    
  900. };
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917. # 44 "/sprite/lib/include/sys/time.h"
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929. struct    itimerval {
  930.     struct    timeval it_interval;    
  931.     struct    timeval it_value;    
  932. };
  933.  
  934.  
  935.  
  936. # 1 "/sprite/lib/include/time.h"
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949. # 1 "/sprite/lib/include/cfuncproto.h"
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983. # 76 "/sprite/lib/include/cfuncproto.h"
  984.  
  985.  
  986. # 13 "/sprite/lib/include/time.h"
  987.  
  988. # 17 "/sprite/lib/include/time.h"
  989.  
  990. # 21 "/sprite/lib/include/time.h"
  991.  
  992.  
  993.  
  994.  
  995.  
  996. struct tm {
  997.     int    tm_sec;
  998.     int    tm_min;
  999.     int    tm_hour;
  1000.     int    tm_mday;
  1001.     int    tm_mon;
  1002.     int    tm_year;
  1003.     int    tm_wday;
  1004.     int    tm_yday;
  1005.     int    tm_isdst;
  1006.     long    tm_gmtoff;
  1007.     char    *tm_zone;
  1008. };
  1009.  
  1010.         extern clock_t clock     ();
  1011.         extern time_t time     ();
  1012.         extern time_t mktime     ();
  1013.         extern double difftime     ();
  1014.         extern struct tm *gmtime     ();
  1015.         extern struct tm *localtime     ();
  1016.         extern char *asctime     ();
  1017.         extern char *ctime     ();
  1018.         extern int strftime 
  1019.     ();
  1020.  
  1021.  
  1022. # 62 "/sprite/lib/include/sys/time.h"
  1023.  
  1024.  
  1025.         extern int    getitimer     ();
  1026.         extern int    gettimeofday 
  1027.     ();
  1028.         extern int    settimeofday 
  1029.     ();
  1030.         extern int    setitimer 
  1031.     ();
  1032.         extern int    utimes 
  1033.     ();
  1034.  
  1035.  
  1036. # 50 "rcp.c"
  1037.  
  1038. # 1 "/sprite/lib/include/sys/ioctl.h"
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053. # 1 "/sprite/lib/include/sys/ttychars.h"
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068. struct ttychars {
  1069.     char    tc_erase;    
  1070.     char    tc_kill;    
  1071.     char    tc_intrc;    
  1072.     char    tc_quitc;    
  1073.     char    tc_startc;    
  1074.     char    tc_stopc;    
  1075.     char    tc_eofc;    
  1076.     char    tc_brkc;    
  1077.     char    tc_suspc;    
  1078.     char    tc_dsuspc;    
  1079.     char    tc_rprntc;    
  1080.     char    tc_flushc;    
  1081.     char    tc_werasc;    
  1082.     char    tc_lnextc;    
  1083. };
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104. # 15 "/sprite/lib/include/sys/ioctl.h"
  1105.  
  1106.  
  1107.  
  1108. # 1 "/sprite/lib/include/sys/ttydev.h"
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144. # 18 "/sprite/lib/include/sys/ioctl.h"
  1145.  
  1146.  
  1147.  
  1148.  
  1149. # 1 "/sprite/lib/include/sys/fb.h"
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216. typedef struct    fbtype {
  1217.     int    fb_type;    
  1218.     int    fb_height;    
  1219.     int    fb_width;    
  1220.     int    fb_depth;    
  1221.     int    fb_cmsize;    
  1222.     int    fb_size;    
  1223. } fbtype;
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230. typedef struct    fbinfo {
  1231.     int        fb_physaddr;    
  1232.     int        fb_hwwidth;    
  1233.     int        fb_hwheight;    
  1234.     int        fb_addrdelta;    
  1235.     unsigned char    *fb_ropaddr;    
  1236.     int        fb_unit;    
  1237. } fbinfo;
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244. typedef struct    fbcmap {
  1245.     int        index;        
  1246.     int        count;        
  1247.     unsigned char    *red;        
  1248.     unsigned char    *green;        
  1249.     unsigned char    *blue;        
  1250. } fbcmap;
  1251.  
  1252.  
  1253. typedef struct fbsattr {
  1254.     int    flags;            
  1255.  
  1256.  
  1257.     int    emu_type;        
  1258.     int    dev_specific[8    ];    
  1259. } fbsattr;
  1260.  
  1261.  
  1262. typedef struct fbgattr {
  1263.     int    real_type;        
  1264.     int    owner;            
  1265.     struct    fbtype fbtype;        
  1266.     struct    fbsattr sattr;        
  1267.     int    emu_types[4    ];    
  1268.                         
  1269. } fbgattr;
  1270.  
  1271. struct    fbpixrect {
  1272.     struct pixrect    *fbpr_pixrect;    
  1273. };
  1274.  
  1275.  
  1276.  
  1277.  
  1278. # 22 "/sprite/lib/include/sys/ioctl.h"
  1279.  
  1280.  
  1281.  
  1282. # 1 "/sprite/lib/include/cfuncproto.h"
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316. # 76 "/sprite/lib/include/cfuncproto.h"
  1317.  
  1318.  
  1319. # 25 "/sprite/lib/include/sys/ioctl.h"
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325. struct tchars {
  1326.     char    t_intrc;    
  1327.     char    t_quitc;    
  1328.     char    t_startc;    
  1329.     char    t_stopc;    
  1330.     char    t_eofc;        
  1331.     char    t_brkc;        
  1332. };
  1333. struct ltchars {
  1334.     char    t_suspc;    
  1335.     char    t_dsuspc;    
  1336.     char    t_rprntc;    
  1337.     char    t_flushc;    
  1338.     char    t_werasc;    
  1339.     char    t_lnextc;    
  1340. };
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348. struct sgttyb {
  1349.     char    sg_ispeed;        
  1350.     char    sg_ospeed;        
  1351.     char    sg_erase;        
  1352.     char    sg_kill;        
  1353.     short    sg_flags;        
  1354. };
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365. struct winsize {
  1366.     unsigned short    ws_row;            
  1367.     unsigned short    ws_col;            
  1368.     unsigned short    ws_xpixel;        
  1369.     unsigned short    ws_ypixel;        
  1370. };
  1371.  
  1372.  
  1373.  
  1374.  
  1375. struct ttysize {
  1376.     unsigned short    ts_lines;
  1377.     unsigned short    ts_cols;
  1378.     unsigned short    ts_xxx;
  1379.     unsigned short    ts_yyy;
  1380. };
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402.  
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462.  
  1463.  
  1464.  
  1465.  
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575. # 280 "/sprite/lib/include/sys/ioctl.h"
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608. extern int ioctl     ();
  1609.  
  1610.  
  1611. # 51 "rcp.c"
  1612.  
  1613. # 1 "/sprite/lib/include/sys/socket.h"
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672. struct    linger {
  1673.     int    l_onoff;        
  1674.     int    l_linger;        
  1675. };
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709. struct sockaddr {
  1710.     u_short    sa_family;        
  1711.     char    sa_data[14];        
  1712. };
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718. struct sockproto {
  1719.     u_short    sp_family;        
  1720.     u_short    sp_protocol;        
  1721. };
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754. struct msghdr {
  1755.     caddr_t    msg_name;        
  1756.     int    msg_namelen;        
  1757.     struct    iovec *msg_iov;        
  1758.     int    msg_iovlen;        
  1759.     caddr_t    msg_accrights;        
  1760.     int    msg_accrightslen;
  1761. };
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770. # 52 "rcp.c"
  1771.  
  1772. # 1 "/sprite/lib/include/sys/wait.h"
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794. # 1 "/sprite/lib/include/machine/machparam.h"
  1795.  
  1796.  
  1797.  
  1798.  
  1799.  
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845. # 77 "/sprite/lib/include/machine/machparam.h"
  1846.  
  1847. # 22 "/sprite/lib/include/sys/wait.h"
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854. union wait    {
  1855.     int    w_status;        
  1856.     
  1857.  
  1858.  
  1859.     struct {
  1860.  
  1861.         unsigned int    w_Termsig:7;    
  1862.         unsigned int    w_Coredump:1;    
  1863.         unsigned int    w_Retcode:8;    
  1864.  
  1865. # 44 "/sprite/lib/include/sys/wait.h"
  1866.  
  1867.     } w_T;
  1868.     
  1869.  
  1870.  
  1871.  
  1872.  
  1873.     struct {
  1874.  
  1875.         unsigned int    w_Stopval:8;    
  1876.         unsigned int    w_Stopsig:8;    
  1877. # 59 "/sprite/lib/include/sys/wait.h"
  1878.  
  1879.     } w_S;
  1880. };
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904. # 85 "/sprite/lib/include/sys/wait.h"
  1905.  
  1906.  
  1907. # 87 "/sprite/lib/include/sys/wait.h"
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913. extern int wait();
  1914. extern int wait3();
  1915.  
  1916.  
  1917. # 53 "rcp.c"
  1918.  
  1919. # 1 "/sprite/lib/include/netinet/in.h"
  1920.  
  1921.  
  1922.  
  1923.  
  1924.  
  1925.  
  1926.  
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932.  
  1933.  
  1934.  
  1935.  
  1936.  
  1937. # 20 "/sprite/lib/include/netinet/in.h"
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981. struct in_addr {
  1982.     u_long s_addr;
  1983. };
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.  
  1992.  
  1993.  
  1994.  
  1995.  
  1996.  
  1997.  
  1998.  
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.  
  2006.  
  2007.  
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018.  
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024. struct sockaddr_in {
  2025.     short    sin_family;
  2026.     u_short    sin_port;
  2027.     struct    in_addr sin_addr;
  2028.     char    sin_zero[8];
  2029. };
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040. # 127 "/sprite/lib/include/netinet/in.h"
  2041.  
  2042. unsigned short  ntohs(), htons();
  2043. unsigned long   ntohl(), htonl();
  2044.  
  2045.  
  2046.  
  2047. # 54 "rcp.c"
  2048.  
  2049. # 1 "/sprite/lib/include/netinet/in_systm.h"
  2050.  
  2051.  
  2052.  
  2053.  
  2054.  
  2055.  
  2056.  
  2057.  
  2058.  
  2059.  
  2060.  
  2061.  
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080. typedef u_short n_short;        
  2081. typedef u_long    n_long;            
  2082.  
  2083. typedef    u_long    n_time;            
  2084.  
  2085. # 38 "/sprite/lib/include/netinet/in_systm.h"
  2086.  
  2087.  
  2088.  
  2089. # 55 "rcp.c"
  2090.  
  2091. # 1 "/sprite/lib/include/netinet/ip.h"
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.  
  2121.  
  2122. struct ip {
  2123.  
  2124.     u_char    ip_hl:4,        
  2125.         ip_v:4;            
  2126.  
  2127. # 39 "/sprite/lib/include/netinet/ip.h"
  2128.  
  2129.     u_char    ip_tos;            
  2130.     short    ip_len;            
  2131.     u_short    ip_id;            
  2132.     short    ip_off;            
  2133.  
  2134.  
  2135.     u_char    ip_ttl;            
  2136.     u_char    ip_p;            
  2137.     u_short    ip_sum;            
  2138.     struct    in_addr ip_src,ip_dst;    
  2139. };
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176. struct    ip_timestamp {
  2177.     u_char    ipt_code;        
  2178.     u_char    ipt_len;        
  2179.     u_char    ipt_ptr;        
  2180.  
  2181.     u_char    ipt_flg:4,        
  2182.         ipt_oflw:4;        
  2183.  
  2184. # 98 "/sprite/lib/include/netinet/ip.h"
  2185.  
  2186.     union ipt_timestamp {
  2187.         n_long    ipt_time[1];
  2188.         struct    ipt_ta {
  2189.             struct in_addr ipt_addr;
  2190.             n_long ipt_time;
  2191.         } ipt_ta[1];
  2192.     } ipt_timestamp;
  2193. };
  2194.  
  2195.  
  2196.  
  2197.  
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.  
  2204.  
  2205.  
  2206.  
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219. # 56 "rcp.c"
  2220.  
  2221. # 1 "/sprite/lib/include/dirent.h"
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234. # 1 "/sprite/lib/include/sys/types.h"
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.  
  2252.  
  2253.  
  2254.  
  2255.  
  2256.  
  2257.  
  2258.  
  2259.  
  2260.  
  2261.  
  2262. # 129 "/sprite/lib/include/sys/types.h"
  2263.  
  2264. # 13 "/sprite/lib/include/dirent.h"
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270. struct dirent {
  2271.     off_t    d_off;        
  2272.     u_long    d_fileno;    
  2273.     u_short    d_reclen;    
  2274.     u_short    d_namlen;    
  2275.     char    d_name[255+1];
  2276. };
  2277.  
  2278.  
  2279. # 57 "rcp.c"
  2280.  
  2281. # 1 "/sprite/lib/include/fcntl.h"
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295. # 1 "/sprite/lib/include/cfuncproto.h"
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.  
  2318.  
  2319.  
  2320.  
  2321.  
  2322.  
  2323.  
  2324.  
  2325.  
  2326.  
  2327.  
  2328.  
  2329. # 76 "/sprite/lib/include/cfuncproto.h"
  2330.  
  2331.  
  2332. # 14 "/sprite/lib/include/fcntl.h"
  2333.  
  2334.  
  2335.  
  2336.  
  2337.  
  2338.  
  2339.  
  2340.  
  2341.  
  2342.                     
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374. extern int open     ();
  2375.  
  2376.  
  2377. # 58 "rcp.c"
  2378.  
  2379. # 1 "/sprite/lib/include/signal.h"
  2380.  
  2381.  
  2382.  
  2383.  
  2384.  
  2385.  
  2386.  
  2387.  
  2388.  
  2389.  
  2390.  
  2391.  
  2392.  
  2393.  
  2394.  
  2395.  
  2396.  
  2397.  
  2398.  
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411. # 134 "/sprite/lib/include/signal.h"
  2412.  
  2413. # 59 "rcp.c"
  2414.  
  2415. # 1 "/sprite/lib/include/pwd.h"
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448. struct passwd {
  2449.     char    *pw_name;            
  2450.     char    *pw_passwd;            
  2451.     int    pw_uid;                
  2452.     int    pw_gid;                
  2453.     long    pw_change;            
  2454.     char    *pw_class;            
  2455.     char    *pw_gecos;            
  2456.     char    *pw_dir;            
  2457.     char    *pw_shell;            
  2458.     long    pw_expire;            
  2459. };
  2460.  
  2461. struct passwd *getpwent(), *getpwuid(), *getpwnam();
  2462. void endpwent(), setpwfile();
  2463. int setpassent(), setpwent();
  2464.  
  2465.  
  2466. # 60 "rcp.c"
  2467.  
  2468. # 1 "/sprite/lib/include/netdb.h"
  2469.  
  2470.  
  2471.  
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493. struct    hostent {
  2494.     char    *h_name;    
  2495.     char    **h_aliases;    
  2496.     int    h_addrtype;    
  2497.     int    h_length;    
  2498.     char    **h_addr_list;    
  2499.  
  2500. };
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506. struct    netent {
  2507.     char        *n_name;    
  2508.     char        **n_aliases;    
  2509.     int        n_addrtype;    
  2510.     unsigned long    n_net;        
  2511. };
  2512.  
  2513. struct    servent {
  2514.     char    *s_name;    
  2515.     char    **s_aliases;    
  2516.     int    s_port;        
  2517.     char    *s_proto;    
  2518. };
  2519.  
  2520. struct    protoent {
  2521.     char    *p_name;    
  2522.     char    **p_aliases;    
  2523.     int    p_proto;    
  2524. };
  2525.  
  2526. struct hostent    *gethostbyname(), *gethostbyaddr(), *gethostent();
  2527. struct netent    *getnetbyname(), *getnetbyaddr(), *getnetent();
  2528. struct servent    *getservbyname(), *getservbyport(), *getservent();
  2529. struct protoent    *getprotobyname(), *getprotobynumber(), *getprotoent();
  2530.  
  2531.  
  2532.  
  2533.  
  2534.  
  2535.  
  2536.  
  2537.  
  2538.  
  2539.  
  2540.  
  2541.  
  2542.  
  2543. # 61 "rcp.c"
  2544.  
  2545. # 1 "/sprite/lib/include/errno.h"
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567. extern int    errno;        
  2568.  
  2569. extern int    sys_nerr;    
  2570. extern char    *sys_errlist[];    
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.  
  2582.  
  2583.  
  2584.  
  2585.  
  2586.  
  2587.  
  2588.  
  2589.  
  2590.  
  2591.  
  2592.  
  2593.  
  2594.  
  2595.  
  2596.  
  2597.  
  2598.  
  2599.  
  2600.  
  2601.  
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.  
  2648.  
  2649.  
  2650.  
  2651.  
  2652. # 62 "rcp.c"
  2653.  
  2654. # 1 "/sprite/lib/include/unistd.h"
  2655.  
  2656.  
  2657.  
  2658.  
  2659.  
  2660.  
  2661.  
  2662.  
  2663.  
  2664.  
  2665.  
  2666.  
  2667.  
  2668.  
  2669.  
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676. # 1 "/sprite/lib/include/cfuncproto.h"
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710. # 76 "/sprite/lib/include/cfuncproto.h"
  2711.  
  2712.  
  2713. # 22 "/sprite/lib/include/unistd.h"
  2714.  
  2715. # 1 "/sprite/lib/include/sys/types.h"
  2716.  
  2717.  
  2718.  
  2719.  
  2720.  
  2721.  
  2722.  
  2723.  
  2724.  
  2725.  
  2726.  
  2727.  
  2728.  
  2729.  
  2730.  
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743. # 129 "/sprite/lib/include/sys/types.h"
  2744.  
  2745. # 23 "/sprite/lib/include/unistd.h"
  2746.  
  2747. # 26 "/sprite/lib/include/unistd.h"
  2748.  
  2749.  
  2750.  
  2751.  
  2752. # 32 "/sprite/lib/include/unistd.h"
  2753.  
  2754.  
  2755. # 37 "/sprite/lib/include/unistd.h"
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763. extern void  _exit     ();
  2764. extern int access     ();
  2765. extern int chdir     ();
  2766. extern int chown     ();
  2767. extern int close     ();
  2768. extern int dup     ();
  2769. extern int dup2     ();
  2770. extern int execl     ();
  2771. extern int execle     ();
  2772. extern int execlp     ();
  2773. extern int execv     ();
  2774. extern int execve     ();
  2775. extern int execvp     ();
  2776. extern int fork     ();
  2777. extern char *getcwd     ();
  2778. extern gid_t getegid     ();
  2779. extern uid_t geteuid     ();
  2780. extern gid_t getgid     ();
  2781. extern int getgroups     ();
  2782. extern int getpid     ();
  2783. extern uid_t getuid     ();
  2784. extern int isatty     ();
  2785. extern long lseek     ();
  2786. extern int pipe     ();
  2787. extern int read     ();
  2788. extern int setgid     ();
  2789. extern int setuid     ();
  2790. extern unsigned sleep     ();
  2791. extern char *ttyname     ();
  2792. extern int unlink     ();
  2793. extern int write     ();
  2794.  
  2795.  
  2796. extern char *crypt     ();
  2797. extern int fchown     ();
  2798. extern int flock     ();
  2799. extern int ftruncate     ();
  2800. extern int readlink     ();
  2801. extern int setegid     ();
  2802. extern int seteuid     ();
  2803. extern int setreuid     ();
  2804. extern int symlink     ();
  2805. extern int ttyslot     ();
  2806. extern int truncate     ();
  2807. extern int umask     ();
  2808. extern _VoidPtr    valloc     ();
  2809. extern int vfork     ();
  2810.  
  2811.  
  2812.  
  2813.  
  2814. # 63 "rcp.c"
  2815.  
  2816. # 1 "/sprite/lib/include/stdio.h"
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.  
  2843.  
  2844.  
  2845.  
  2846.  
  2847. # 1 "/sprite/lib/include/cfuncproto.h"
  2848.  
  2849.  
  2850.  
  2851.  
  2852.  
  2853.  
  2854.  
  2855.  
  2856.  
  2857.  
  2858.  
  2859.  
  2860.  
  2861.  
  2862.  
  2863.  
  2864.  
  2865.  
  2866.  
  2867.  
  2868.  
  2869.  
  2870.  
  2871.  
  2872.  
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878.  
  2879.  
  2880.  
  2881. # 76 "/sprite/lib/include/cfuncproto.h"
  2882.  
  2883.  
  2884. # 31 "/sprite/lib/include/stdio.h"
  2885.  
  2886. # 34 "/sprite/lib/include/stdio.h"
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893. # 42 "/sprite/lib/include/stdio.h"
  2894.  
  2895.  
  2896.  
  2897. typedef int *ClientData;
  2898.  
  2899.  
  2900.  
  2901.  
  2902.  
  2903. typedef char *va_list;
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  
  2913.  
  2914.  
  2915.  
  2916.  
  2917.  
  2918.  
  2919.  
  2920.  
  2921.  
  2922.  
  2923.  
  2924.  
  2925.  
  2926.  
  2927.  
  2928.  
  2929.  
  2930.  
  2931.  
  2932.  
  2933.  
  2934.  
  2935.  
  2936.  
  2937.  
  2938.  
  2939.  
  2940.  
  2941.  
  2942.  
  2943.  
  2944.  
  2945.  
  2946.  
  2947.  
  2948.  
  2949.  
  2950.  
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956. typedef struct _file {
  2957.     unsigned char *lastAccess;    
  2958.  
  2959.  
  2960.     int readCount;        
  2961.  
  2962.  
  2963.     int writeCount;        
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  
  2969.     unsigned char *buffer;    
  2970.  
  2971.     int bufSize;        
  2972.  
  2973.  
  2974.     void (*readProc)    ();
  2975.                 
  2976.     void (*writeProc)    ();
  2977.                 
  2978.     int (*closeProc)    ();
  2979.                 
  2980.  
  2981.     ClientData clientData;    
  2982.  
  2983.  
  2984.     int status;            
  2985.  
  2986.  
  2987.     int flags;            
  2988.  
  2989.     struct _file *nextPtr;    
  2990.  
  2991.  
  2992.  
  2993.  
  2994. } FILE;
  2995.  
  2996.  
  2997.  
  2998.  
  2999.  
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.  
  3041.  
  3042.  
  3043.  
  3044.  
  3045.  
  3046.  
  3047.  
  3048.  
  3049.  
  3050.  
  3051.  
  3052.  
  3053. # 201 "/sprite/lib/include/stdio.h"
  3054.  
  3055.  
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061. # 208 "/sprite/lib/include/stdio.h"
  3062.  
  3063. # 212 "/sprite/lib/include/stdio.h"
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.  
  3107.  
  3108. extern FILE stdioInFile, stdioOutFile, stdioErrFile;
  3109.  
  3110.  
  3111.  
  3112.  
  3113.  
  3114.  
  3115.  
  3116.  
  3117.  
  3118.  
  3119.  
  3120.  
  3121.  
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.  
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.  
  3143.  
  3144.  
  3145.         extern void    clearerr     ();
  3146.         extern int    fclose     ();
  3147.         extern FILE *    fdopen     ();
  3148.         extern int    fflush     ();
  3149.         extern int    fgetc     ();
  3150.         extern char *    fgets     ();
  3151.         extern int    fileno     ();
  3152.         extern FILE *    fopen     ();
  3153.         extern int    fputc     ();
  3154.         extern int    fputs     ();
  3155.         extern int    fread 
  3156.     ();
  3157.         extern FILE *    freopen 
  3158.     ();
  3159.         extern long    fseek     ();
  3160.         extern long    ftell     ();
  3161.         extern int    fwrite 
  3162.     ();
  3163.         extern char *    gets     ();
  3164.         extern int    getw     ();
  3165.         extern void    perror     ();
  3166.         extern FILE *    popen     ();
  3167.         extern int    pclose     ();
  3168.         extern int      remove     ();
  3169.         extern int      rename     ();
  3170.  
  3171.  
  3172.  
  3173.  
  3174.  
  3175.  
  3176. # 336 "/sprite/lib/include/stdio.h"
  3177.  
  3178.  
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.         extern int    printf     ();
  3186.         extern int    fprintf     ();
  3187.         extern int    scanf     ();
  3188.         extern char *    sprintf     ();
  3189.         extern int    sscanf     ();
  3190.         extern int    fscanf     ();
  3191.         extern int    vfprintf 
  3192.     ();
  3193.         extern int    vfscanf 
  3194.     ();
  3195.         extern int    vprintf     ();
  3196.         extern char *    vsprintf 
  3197.     ();
  3198.  
  3199.  
  3200.         extern int    puts     ();
  3201.         extern int    putw     ();
  3202.         extern void    rewind     ();
  3203.         extern void    setbuf     ();
  3204.         extern void    setbuffer     ();
  3205.         extern void    setlinebuf     ();
  3206.         extern int    setvbuf     ();
  3207.         extern FILE *    tmpfile     ();
  3208.         extern char *    tmpnam     ();
  3209.         extern char *    tempnam     ();
  3210.         extern int    ungetc     ();
  3211.         extern void    _cleanup     ();
  3212.  
  3213.         extern void    Stdio_Setup 
  3214.  
  3215.  
  3216.  
  3217.  
  3218.     ();
  3219.  
  3220.  
  3221. # 64 "rcp.c"
  3222.  
  3223. # 1 "/sprite/lib/include/stdlib.h"
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.  
  3247.  
  3248.  
  3249.  
  3250.  
  3251.  
  3252.  
  3253.  
  3254.  
  3255. # 1 "/sprite/lib/include/cfuncproto.h"
  3256.  
  3257.  
  3258.  
  3259.  
  3260.  
  3261.  
  3262.  
  3263.  
  3264.  
  3265.  
  3266.  
  3267.  
  3268.  
  3269.  
  3270.  
  3271.  
  3272.  
  3273.  
  3274.  
  3275.  
  3276.  
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289. # 76 "/sprite/lib/include/cfuncproto.h"
  3290.  
  3291.  
  3292. # 32 "/sprite/lib/include/stdlib.h"
  3293.  
  3294. # 36 "/sprite/lib/include/stdlib.h"
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300. # 45 "/sprite/lib/include/stdlib.h"
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.  
  3308.  
  3309.         extern double     atof     ();
  3310.         extern int     atoi     ();
  3311.         extern long int atol     ();
  3312.         extern double     strtod     ();
  3313.         extern long int strtol     ();
  3314.         extern unsigned long int
  3315.         strtoul     ();
  3316.  
  3317.  
  3318.  
  3319.  
  3320.  
  3321.  
  3322.  
  3323.  
  3324.  
  3325.  
  3326.  
  3327.  
  3328.  
  3329.  
  3330. # 95 "/sprite/lib/include/stdlib.h"
  3331.  
  3332.  
  3333.         extern _VoidPtr    malloc     ();
  3334.         extern int    free     ();
  3335.  
  3336.  
  3337.  
  3338.         extern _VoidPtr calloc     ();
  3339.         extern _VoidPtr    realloc     ();
  3340.         extern void    Mem_Bin     ();
  3341.         extern char *    Mem_CallerPC();
  3342.         extern void    Mem_DumpTrace     ();
  3343.         extern void    Mem_PrintConfig     ();
  3344.         extern void    Mem_PrintInUse     ();
  3345.         extern void    Mem_PrintStats     ();
  3346.         extern void    Mem_PrintStatsInt     ();
  3347.  
  3348.  
  3349.  
  3350.  
  3351.         extern void    Mem_SetPrintProc     ();
  3352.         extern int    Mem_Size     ();
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358. typedef struct {
  3359.     int        size;    
  3360.     int        flags;    
  3361. } Mem_TraceInfo;
  3362.  
  3363.         extern void    Mem_SetTraceSizes 
  3364.     ();
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.  
  3371.  
  3372.  
  3373.  
  3374.  
  3375.  
  3376.  
  3377.  
  3378.  
  3379.  
  3380.  
  3381.  
  3382.  
  3383.  
  3384. extern int    mem_SmallMinNum;
  3385. extern int    mem_LargeMinNum;
  3386. extern int    mem_LargeMaxSize;
  3387.  
  3388.  
  3389.  
  3390.  
  3391.  
  3392. extern int    mem_NumAllocs;
  3393. extern int    mem_NumFrees;
  3394.  
  3395.  
  3396.  
  3397.  
  3398.  
  3399.  
  3400.  
  3401.  
  3402. typedef struct div_t {
  3403.     int quot;
  3404.     int rem;
  3405. } div_t;
  3406.  
  3407. typedef struct {
  3408.     long int quot;
  3409.     long int rem;
  3410. } ldiv_t;
  3411.  
  3412.         extern int    abs     ();
  3413.         extern div_t    div     ();
  3414.         extern long int labs     ();
  3415.         extern ldiv_t    ldiv     ();
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.         extern void    abort     ();
  3424.         extern int    atexit     ();
  3425.         extern _VoidPtr bsearch 
  3426.  
  3427.     ();
  3428.         extern int    exit     ();
  3429.         extern char *    getenv     ();
  3430.         extern void    qsort 
  3431.     ();
  3432.         extern int    rand     ();
  3433.         extern long    random     ();
  3434.         extern int    srand     ();
  3435.         extern int    srandom     ();
  3436.         extern int    system     ();
  3437.  
  3438.  
  3439. # 65 "rcp.c"
  3440.  
  3441. # 1 "/sprite/lib/include/string.h"
  3442.  
  3443.  
  3444.  
  3445.  
  3446.  
  3447.  
  3448.  
  3449.  
  3450.  
  3451.  
  3452.  
  3453.  
  3454.  
  3455.  
  3456.  
  3457.  
  3458.  
  3459.  
  3460.  
  3461.  
  3462.  
  3463. # 1 "/sprite/lib/include/cfuncproto.h"
  3464.  
  3465.  
  3466.  
  3467.  
  3468.  
  3469.  
  3470.  
  3471.  
  3472.  
  3473.  
  3474.  
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.  
  3481.  
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.  
  3494.  
  3495.  
  3496.  
  3497. # 76 "/sprite/lib/include/cfuncproto.h"
  3498.  
  3499.  
  3500. # 22 "/sprite/lib/include/string.h"
  3501.  
  3502. extern _VoidPtr    memchr     ();
  3503. extern int    memcmp     ();
  3504. extern _VoidPtr    memcpy     ();
  3505. extern _VoidPtr    memmove     ();
  3506. extern _VoidPtr    memset     ();
  3507.  
  3508. extern int    strcasecmp     ();
  3509. extern char *    strcat     ();
  3510. extern char *    strchr     ();
  3511. extern int    strcmp     ();
  3512. extern char *    strcpy     ();
  3513. extern int    strcspn     ();
  3514. extern char *    strdup     ();
  3515. extern char *    strerror     ();
  3516. extern int    strlen     ();
  3517. extern int    strncasecmp     ();
  3518. extern char *    strncat     ();
  3519. extern int    strncmp     ();
  3520. extern char *    strncpy     ();
  3521. extern char *    strpbrk     ();
  3522. extern char *    strrchr     ();
  3523. extern int    strspn     ();
  3524. extern char *    strstr     ();
  3525. extern char *    strtok     ();
  3526.  
  3527.  
  3528.  
  3529.  
  3530.  
  3531. extern char *    index     ();
  3532. extern char *    rindex     ();
  3533.  
  3534.  
  3535. # 66 "rcp.c"
  3536.  
  3537. # 1 "/sprite/lib/include/ctype.h"
  3538.  
  3539.  
  3540.  
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.  
  3560. # 1 "/sprite/lib/include/cfuncproto.h"
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.  
  3570.  
  3571.  
  3572.  
  3573.  
  3574.  
  3575.  
  3576.  
  3577.  
  3578.  
  3579.  
  3580.  
  3581.  
  3582.  
  3583.  
  3584.  
  3585.  
  3586.  
  3587.  
  3588.  
  3589.  
  3590.  
  3591.  
  3592.  
  3593.  
  3594. # 76 "/sprite/lib/include/cfuncproto.h"
  3595.  
  3596.  
  3597. # 23 "/sprite/lib/include/ctype.h"
  3598.  
  3599. # 26 "/sprite/lib/include/ctype.h"
  3600.  
  3601.  
  3602.         extern int    isalnum     ();
  3603.         extern int    isalpha     ();
  3604.         extern int    isascii     ();
  3605.         extern int    iscntrl     ();
  3606.         extern int    isdigit     ();
  3607.         extern int    isgraph     ();
  3608.         extern int    islower     ();
  3609.         extern int    isprint     ();
  3610.         extern int    ispunct     ();
  3611.         extern int    isspace     ();
  3612.         extern int    isupper     ();
  3613.         extern int    isxdigit     ();
  3614.         extern int    tolower     ();
  3615.         extern int    toupper     ();
  3616.  
  3617.  
  3618.  
  3619. # 45 "/sprite/lib/include/ctype.h"
  3620.  
  3621.  
  3622.  
  3623. # 48 "/sprite/lib/include/ctype.h"
  3624.  
  3625.  
  3626.  
  3627. # 51 "/sprite/lib/include/ctype.h"
  3628.  
  3629.  
  3630.  
  3631. # 54 "/sprite/lib/include/ctype.h"
  3632.  
  3633.  
  3634.  
  3635. # 57 "/sprite/lib/include/ctype.h"
  3636.  
  3637.  
  3638.  
  3639. # 60 "/sprite/lib/include/ctype.h"
  3640.  
  3641.  
  3642.  
  3643. # 63 "/sprite/lib/include/ctype.h"
  3644.  
  3645.  
  3646.  
  3647. # 66 "/sprite/lib/include/ctype.h"
  3648.  
  3649.  
  3650.  
  3651. # 69 "/sprite/lib/include/ctype.h"
  3652.  
  3653.  
  3654.  
  3655. # 72 "/sprite/lib/include/ctype.h"
  3656.  
  3657.  
  3658.  
  3659. # 75 "/sprite/lib/include/ctype.h"
  3660.  
  3661.  
  3662.  
  3663. # 78 "/sprite/lib/include/ctype.h"
  3664.  
  3665.  
  3666.  
  3667.  
  3668.  
  3669.  
  3670.  
  3671.  
  3672.  
  3673.  
  3674.  
  3675. extern char _ctype_bits[];
  3676.  
  3677. # 67 "rcp.c"
  3678.  
  3679. # 1 "./pathnames.h"
  3680.  
  3681.  
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.  
  3701.  
  3702.  
  3703.  
  3704.  
  3705.  
  3706.  
  3707.  
  3708.  
  3709.  
  3710.  
  3711.  
  3712.  
  3713.  
  3714.  
  3715.  
  3716.  
  3717. # 68 "rcp.c"
  3718.  
  3719. # 84 "rcp.c"
  3720.  
  3721.  
  3722.  
  3723.  
  3724. struct passwd *pwd;
  3725. u_short    port;
  3726. uid_t    userid;
  3727. int errs, rem;
  3728. int pflag, iamremote, iamrecursive, targetshouldbedirectory;
  3729.  
  3730.  
  3731. char cmd[64];        
  3732.  
  3733. typedef struct _buf {
  3734.     int    cnt;
  3735.     char    *buf;
  3736. } BUF;
  3737.  
  3738. void lostconn();
  3739.  
  3740. main(argc, argv)
  3741.     int argc;
  3742.     char **argv;
  3743. {
  3744.     extern int optind;
  3745.     extern char *optarg;
  3746.     struct servent *sp;
  3747.     int ch, fflag, tflag;
  3748.     char *targ, *shell, *colon();
  3749.  
  3750.     fflag = tflag = 0;
  3751.     while ((ch = getopt(argc, argv, "dfprt")) != (-1))
  3752.         switch(ch) {
  3753.         
  3754.         case 'p':            
  3755.             ++pflag;
  3756.             break;
  3757.         case 'r':
  3758.             ++iamrecursive;
  3759.             break;
  3760. # 135 "rcp.c"
  3761.  
  3762.         
  3763.         case 'd':
  3764.             targetshouldbedirectory = 1;
  3765.             break;
  3766.         case 'f':            
  3767.             iamremote = 1;
  3768.             fflag = 1;
  3769.             break;
  3770.         case 't':            
  3771.             iamremote = 1;
  3772.             tflag = 1;
  3773.             break;
  3774.  
  3775.         case '?':
  3776.         default:
  3777.             usage();
  3778.         }
  3779.     argc -= optind;
  3780.     argv += optind;
  3781.  
  3782. # 171 "rcp.c"
  3783.  
  3784.     sp = getservbyname(shell = "shell", "tcp");
  3785.  
  3786.     if (sp == 0) {
  3787.         (void)fprintf((&stdioErrFile), "rcp: %s/tcp: unknown service\n", shell);
  3788.         exit(1);
  3789.     }
  3790.     port = sp->s_port;
  3791.  
  3792.     if (!(pwd = getpwuid(userid = getuid()))) {
  3793.         (void)fprintf((&stdioErrFile), "rcp: unknown user %d.\n", (int)userid);
  3794.         exit(1);
  3795.     }
  3796.  
  3797.     if (fflag) {
  3798.         
  3799.         (void)response();
  3800.         (void)setuid(userid);
  3801.         source(argc, argv);
  3802.         exit(errs);
  3803.     }
  3804.  
  3805.     if (tflag) {
  3806.         
  3807.         (void)setuid(userid);
  3808.         sink(argc, argv);
  3809.         exit(errs);
  3810.     }
  3811.  
  3812.     if (argc < 2)
  3813.         usage();
  3814.     if (argc > 2)
  3815.         targetshouldbedirectory = 1;
  3816.  
  3817.     rem = -1;
  3818.     
  3819. # 216 "rcp.c"
  3820.  
  3821.     (void)snprintf(cmd, sizeof(cmd), "rcp%s%s%s",
  3822.         iamrecursive ? " -r" : "", pflag ? " -p" : "",
  3823.         targetshouldbedirectory ? " -d" : "");
  3824.  
  3825.  
  3826.     (void)signal(13    , lostconn);
  3827.  
  3828.     if (targ = colon(argv[argc - 1]))
  3829.         toremote(targ, argc, argv);    
  3830.     else {
  3831.         tolocal(argc, argv);        
  3832.         if (targetshouldbedirectory)
  3833.             verifydir(argv[argc - 1]);
  3834.     }
  3835.     exit(errs);
  3836. }
  3837.  
  3838. toremote(targ, argc, argv)
  3839.     char *targ;
  3840.     int argc;
  3841.     char **argv;
  3842. {
  3843.     int i, len, tos;
  3844.     char *bp, *host, *src, *suser, *thost, *tuser;
  3845.     char *colon();
  3846.  
  3847.     *targ++ = 0;
  3848.     if (*targ == 0)
  3849.         targ = ".";
  3850.  
  3851.     if (thost = index(argv[argc - 1], '@')) {
  3852.         
  3853.         *thost++ = 0;
  3854.         tuser = argv[argc - 1];
  3855.         if (*tuser == '\0')
  3856.             tuser = 0;
  3857.         else if (!okname(tuser))
  3858.             exit(1);
  3859.     } else {
  3860.         thost = argv[argc - 1];
  3861.         tuser = 0;
  3862.     }
  3863.  
  3864.     for (i = 0; i < argc - 1; i++) {
  3865.         src = colon(argv[i]);
  3866.         if (src) {            
  3867.             *src++ = 0;
  3868.             if (*src == 0)
  3869.                 src = ".";
  3870.             host = index(argv[i], '@');
  3871.             len = strlen("/usr/bin/rsh") + strlen(argv[i]) +
  3872.                 strlen(src) + (tuser ? strlen(tuser) : 0) +
  3873.                 strlen(thost) + strlen(targ) + 64 + 20;
  3874.             if (!(bp = malloc(len)))
  3875.                 nospace();
  3876.             if (host) {
  3877.                 *host++ = 0;
  3878.                 suser = argv[i];
  3879.                 if (*suser == '\0')
  3880.                     suser = pwd->pw_name;
  3881.                 else if (!okname(suser))
  3882.                     continue;
  3883.                 (void)snprintf(bp, len,
  3884.                     "%s %s -l %s -n %s %s '%s%s%s:%s'",
  3885.                     "/usr/bin/rsh", host, suser, cmd, src,
  3886.                     tuser ? tuser : "", tuser ? "@" : "",
  3887.                     thost, targ);
  3888.             } else
  3889.                 (void)snprintf(bp, len,
  3890.                     "%s %s -n %s %s '%s%s%s:%s'",
  3891.                     "/usr/bin/rsh", argv[i], cmd, src,
  3892.                     tuser ? tuser : "", tuser ? "@" : "",
  3893.                     thost, targ);
  3894.             (void)susystem(bp);
  3895.             (void)free(bp);
  3896.         } else {            
  3897.             if (rem == -1) {
  3898.                 len = strlen(targ) + 64 + 20;
  3899.                 if (!(bp = malloc(len)))
  3900.                     nospace();
  3901.                 (void)snprintf(bp, len, "%s -t %s", cmd, targ);
  3902.                 host = thost;
  3903. # 305 "rcp.c"
  3904.  
  3905.                     rem = rcmd(&host, port, pwd->pw_name,
  3906.                         tuser ? tuser : pwd->pw_name,
  3907.                         bp, 0);
  3908.                 if (rem < 0)
  3909.                     exit(1);
  3910.                 tos = IPTOS_THROUGHPUT;
  3911.                 if (setsockopt(rem,     0        , IP_TOS,
  3912.                     (char *)&tos, sizeof(int)) < 0)
  3913.                     perror("rcp: setsockopt TOS (ignored)");
  3914.                 if (response() < 0)
  3915.                     exit(1);
  3916.                 (void)free(bp);
  3917.                 (void)setuid(userid);
  3918.             }
  3919.             source(1, argv+i);
  3920.         }
  3921.     }
  3922. }
  3923.  
  3924. tolocal(argc, argv)
  3925.     int argc;
  3926.     char **argv;
  3927. {
  3928.     int i, len, tos;
  3929.     char *bp, *host, *src, *suser;
  3930.     char *colon();
  3931.  
  3932.     for (i = 0; i < argc - 1; i++) {
  3933.         if (!(src = colon(argv[i]))) {    
  3934.             len = strlen("/bin/cp") + strlen(argv[i]) +
  3935.                 strlen(argv[argc - 1]) + 20;
  3936.             if (!(bp = malloc(len)))
  3937.                 nospace();
  3938.             (void)snprintf(bp, len, "%s%s%s %s %s", "/bin/cp",
  3939.                 iamrecursive ? " -r" : "", pflag ? " -p" : "",
  3940.                 argv[i], argv[argc - 1]);
  3941.             (void)susystem(bp);
  3942.             (void)free(bp);
  3943.             continue;
  3944.         }
  3945.         *src++ = 0;
  3946.         if (*src == 0)
  3947.             src = ".";
  3948.         host = index(argv[i], '@');
  3949.         if (host) {
  3950.             *host++ = 0;
  3951.             suser = argv[i];
  3952.             if (*suser == '\0')
  3953.                 suser = pwd->pw_name;
  3954.             else if (!okname(suser))
  3955.                 continue;
  3956.         } else {
  3957.             host = argv[i];
  3958.             suser = pwd->pw_name;
  3959.         }
  3960.         len = strlen(src) + 64 + 20;
  3961.         if (!(bp = malloc(len)))
  3962.             nospace();
  3963.         (void)snprintf(bp, len, "%s -f %s", cmd, src);
  3964. # 369 "rcp.c"
  3965.  
  3966.             rem = rcmd(&host, port, pwd->pw_name, suser, bp, 0);
  3967.         (void)free(bp);
  3968.         if (rem < 0)
  3969.             continue;
  3970.         (void)seteuid(userid);
  3971.         tos = IPTOS_THROUGHPUT;
  3972.         if (setsockopt(rem,     0        , IP_TOS,
  3973.             (char *)&tos, sizeof(int)) < 0)
  3974.             perror("rcp: setsockopt TOS (ignored)");
  3975.         sink(1, argv + argc - 1);
  3976.         (void)seteuid(0);
  3977.         (void)close(rem);
  3978.         rem = -1;
  3979.     }
  3980. }
  3981.  
  3982. verifydir(cp)
  3983.     char *cp;
  3984. {
  3985.     struct stat stb;
  3986.  
  3987.     if (stat(cp, &stb) >= 0) {
  3988.         if ((stb.st_mode & 0170000        ) == 0040000    )
  3989.             return;
  3990.         errno =     20;
  3991.     }
  3992.     error("rcp: %s: %s.\n", cp, strerror(errno));
  3993.     exit(1);
  3994. }
  3995.  
  3996. char *
  3997. colon(cp)
  3998.     register char *cp;
  3999. {
  4000.     for (; *cp; ++cp) {
  4001.         if (*cp == ':')
  4002.             return(cp);
  4003.         if (*cp == '/')
  4004.             return(0);
  4005.     }
  4006.     return(0);
  4007. }
  4008.  
  4009. okname(cp0)
  4010.     char *cp0;
  4011. {
  4012.     register char *cp = cp0;
  4013.     register int c;
  4014.  
  4015.     do {
  4016.         c = *cp;
  4017.         if (c & 0200)
  4018.             goto bad;
  4019.         if (!     ((_ctype_bits+1)[c] & (0x01|0x02)) && !     ((_ctype_bits+1)[c] & 0x04) && c != '_' && c != '-')
  4020.             goto bad;
  4021.     } while (*++cp);
  4022.     return(1);
  4023. bad:
  4024.     (void)fprintf((&stdioErrFile), "rcp: invalid user name %s\n", cp0);
  4025.     return(0);
  4026. }
  4027.  
  4028. susystem(s)
  4029.     char *s;
  4030. {
  4031.     int status, pid, w;
  4032.     register sig_t istat, qstat;
  4033.  
  4034.     if ((pid = vfork()) == 0) {
  4035.         (void)setuid(userid);
  4036.         execl(_PATH_BSHELL, "sh", "-c", s, (char *)0);
  4037.         _exit(127);
  4038.     }
  4039.     istat = signal(2    ,     (void (*)())1);
  4040.     qstat = signal(3    ,     (void (*)())1);
  4041.     while ((w = wait(&status)) != pid && w != -1)
  4042.         ;
  4043.     if (w == -1)
  4044.         status = -1;
  4045.     (void)signal(2    , istat);
  4046.     (void)signal(3    , qstat);
  4047.     return(status);
  4048. }
  4049.  
  4050. source(argc, argv)
  4051.     int argc;
  4052.     char **argv;
  4053. {
  4054.     struct stat stb;
  4055.     static BUF buffer;
  4056.     BUF *bp;
  4057.     off_t i;
  4058.     int x, readerr, f, amt;
  4059.     char *last, *name, buf[        4096];
  4060.     BUF *allocbuf();
  4061.  
  4062.     for (x = 0; x < argc; x++) {
  4063.         name = argv[x];
  4064.         if ((f = open(name, 000        , 0)) < 0) {
  4065.             error("rcp: %s: %s\n", name, strerror(errno));
  4066.             continue;
  4067.         }
  4068.         if (fstat(f, &stb) < 0)
  4069.             goto notreg;
  4070.         switch (stb.st_mode&0170000        ) {
  4071.  
  4072.         case 0100000    :
  4073.             break;
  4074.  
  4075.         case 0040000    :
  4076.             if (iamrecursive) {
  4077.                 (void)close(f);
  4078.                 rsource(name, &stb);
  4079.                 continue;
  4080.             }
  4081.             
  4082.         default:
  4083. notreg:            (void)close(f);
  4084.             error("rcp: %s: not a plain file\n", name);
  4085.             continue;
  4086.         }
  4087.         last = rindex(name, '/');
  4088.         if (last == 0)
  4089.             last = name;
  4090.         else
  4091.             last++;
  4092.         if (pflag) {
  4093.             
  4094.  
  4095.  
  4096.  
  4097.             (void)snprintf(buf, sizeof(buf),
  4098.                 "T%ld 0 %ld 0\n", stb.st_mtime, stb.st_atime);
  4099.             (void)write(rem, buf, (int)strlen(buf));
  4100.             if (response() < 0) {
  4101.                 (void)close(f);
  4102.                 continue;
  4103.             }
  4104.         }
  4105.         (void)snprintf(buf, sizeof(buf),
  4106.             "C%04o %ld %s\n", stb.st_mode&07777, stb.st_size, last);
  4107.         (void)write(rem, buf, (int)strlen(buf));
  4108.         if (response() < 0) {
  4109.             (void)close(f);
  4110.             continue;
  4111.         }
  4112.         if ((bp = allocbuf(&buffer, f,         4096)) == 0) {
  4113.             (void)close(f);
  4114.             continue;
  4115.         }
  4116.         readerr = 0;
  4117.         for (i = 0; i < stb.st_size; i += bp->cnt) {
  4118.             amt = bp->cnt;
  4119.             if (i + amt > stb.st_size)
  4120.                 amt = stb.st_size - i;
  4121.             if (readerr == 0 && read(f, bp->buf, amt) != amt)
  4122.                 readerr = errno;
  4123.             (void)write(rem, bp->buf, amt);
  4124.         }
  4125.         (void)close(f);
  4126.         if (readerr == 0)
  4127.             (void)write(rem, "", 1);
  4128.         else
  4129.             error("rcp: %s: %s\n", name, strerror(readerr));
  4130.         (void)response();
  4131.     }
  4132. }
  4133.  
  4134. rsource(name, statp)
  4135.     char *name;
  4136.     struct stat *statp;
  4137. {
  4138.     DIR *dirp;
  4139.     struct dirent *dp;
  4140.     char *last, *vect[1], path[     1024];
  4141.  
  4142.     if (!(dirp = opendir(name))) {
  4143.         error("rcp: %s: %s\n", name, strerror(errno));
  4144.         return;
  4145.     }
  4146.     last = rindex(name, '/');
  4147.     if (last == 0)
  4148.         last = name;
  4149.     else
  4150.         last++;
  4151.     if (pflag) {
  4152.         (void)snprintf(path, sizeof(path),
  4153.             "T%ld 0 %ld 0\n", statp->st_mtime, statp->st_atime);
  4154.         (void)write(rem, path, (int)strlen(path));
  4155.         if (response() < 0) {
  4156.             closedir(dirp);
  4157.             return;
  4158.         }
  4159.     }
  4160.     (void)snprintf(path, sizeof(path),
  4161.         "D%04o %d %s\n", statp->st_mode&07777, 0, last);
  4162.     (void)write(rem, path, (int)strlen(path));
  4163.     if (response() < 0) {
  4164.         closedir(dirp);
  4165.         return;
  4166.     }
  4167.     while (dp = readdir(dirp)) {
  4168.         if (dp->d_ino == 0)
  4169.             continue;
  4170.         if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
  4171.             continue;
  4172.         if (strlen(name) + 1 + strlen(dp->d_name) >=      1024 - 1) {
  4173.             error("%s/%s: name too long.\n", name, dp->d_name);
  4174.             continue;
  4175.         }
  4176.         (void)snprintf(path, sizeof(path), "%s/%s", name, dp->d_name);
  4177.         vect[0] = path;
  4178.         source(1, vect);
  4179.     }
  4180.     closedir(dirp);
  4181.     (void)write(rem, "E\n", 2);
  4182.     (void)response();
  4183. }
  4184.  
  4185. response()
  4186. {
  4187.     register char *cp;
  4188.     char ch, resp, rbuf[        4096];
  4189.  
  4190.     if (read(rem, &resp, sizeof(resp)) != sizeof(resp))
  4191.         lostconn();
  4192.  
  4193.     cp = rbuf;
  4194.     switch(resp) {
  4195.     case 0:                
  4196.         return(0);
  4197.     default:
  4198.         *cp++ = resp;
  4199.         
  4200.     case 1:                
  4201.     case 2:                
  4202.         do {
  4203.             if (read(rem, &ch, sizeof(ch)) != sizeof(ch))
  4204.                 lostconn();
  4205.             *cp++ = ch;
  4206.         } while (cp < &rbuf[        4096] && ch != '\n');
  4207.  
  4208.         if (!iamremote)
  4209.             (void)write(2, rbuf, cp - rbuf);
  4210.         ++errs;
  4211.         if (resp == 1)
  4212.             return(-1);
  4213.         exit(1);
  4214.     }
  4215.     
  4216. }
  4217.  
  4218. void
  4219. lostconn()
  4220. {
  4221.     if (!iamremote)
  4222.         (void)fprintf((&stdioErrFile), "rcp: lost connection\n");
  4223.     exit(1);
  4224. }
  4225.  
  4226. sink(argc, argv)
  4227.     int argc;
  4228.     char **argv;
  4229. {
  4230.     register char *cp;
  4231.     static BUF buffer;
  4232.     struct stat stb;
  4233.     struct timeval tv[2];
  4234.     enum { YES, NO, DISPLAYED } wrerr;
  4235.     BUF *bp, *allocbuf();
  4236.     off_t i, j;
  4237.     char ch, *targ, *why;
  4238.     int amt, count, exists, first, mask, mode;
  4239.     int ofd, setimes, size, targisdir;
  4240.     char *np, *vect[1], buf[        4096];
  4241.  
  4242.  
  4243.  
  4244.  
  4245.  
  4246.     setimes = targisdir = 0;
  4247.     mask = umask(0);
  4248.     if (!pflag)
  4249.         (void)umask(mask);
  4250.     if (argc != 1) {
  4251.         error("rcp: ambiguous target\n");
  4252.         exit(1);
  4253.     }
  4254.     targ = *argv;
  4255.     if (targetshouldbedirectory)
  4256.         verifydir(targ);
  4257.     (void)write(rem, "", 1);
  4258.     if (stat(targ, &stb) == 0 && (stb.st_mode & 0170000        ) == 0040000    )
  4259.         targisdir = 1;
  4260.     for (first = 1;; first = 0) {
  4261.         cp = buf;
  4262.         if (read(rem, cp, 1) <= 0)
  4263.             return;
  4264.         if (*cp++ == '\n')
  4265.                 { why = "unexpected <newline>"; goto screwup; };
  4266.         do {
  4267.             if (read(rem, &ch, sizeof(ch)) != sizeof(ch))
  4268.                     { why = "lost connection"; goto screwup; };
  4269.             *cp++ = ch;
  4270.         } while (cp < &buf[        4096 - 1] && ch != '\n');
  4271.         *cp = 0;
  4272.  
  4273.         if (buf[0] == '\01' || buf[0] == '\02') {
  4274.             if (iamremote == 0)
  4275.                 (void)write(2, buf + 1, (int)strlen(buf + 1));
  4276.             if (buf[0] == '\02')
  4277.                 exit(1);
  4278.             errs++;
  4279.             continue;
  4280.         }
  4281.         if (buf[0] == 'E') {
  4282.             (void)write(rem, "", 1);
  4283.             return;
  4284.         }
  4285.  
  4286.         if (ch == '\n')
  4287.             *--cp = 0;
  4288.  
  4289.  
  4290.         cp = buf;
  4291.         if (*cp == 'T') {
  4292.             setimes++;
  4293.             cp++;
  4294.              (tv[1].tv_sec) = 0; while (     ((_ctype_bits+1)[*cp] & 0x04)) (tv[1].tv_sec) = (tv[1].tv_sec) * 10 + (*cp++ - '0');;
  4295.             if (*cp++ != ' ')
  4296.                     { why = "mtime.sec not delimited"; goto screwup; };
  4297.              (tv[1].tv_usec) = 0; while (     ((_ctype_bits+1)[*cp] & 0x04)) (tv[1].tv_usec) = (tv[1].tv_usec) * 10 + (*cp++ - '0');;
  4298.             if (*cp++ != ' ')
  4299.                     { why = "mtime.usec not delimited"; goto screwup; };
  4300.              (tv[0].tv_sec) = 0; while (     ((_ctype_bits+1)[*cp] & 0x04)) (tv[0].tv_sec) = (tv[0].tv_sec) * 10 + (*cp++ - '0');;
  4301.             if (*cp++ != ' ')
  4302.                     { why = "atime.sec not delimited"; goto screwup; };
  4303.              (tv[0].tv_usec) = 0; while (     ((_ctype_bits+1)[*cp] & 0x04)) (tv[0].tv_usec) = (tv[0].tv_usec) * 10 + (*cp++ - '0');;
  4304.             if (*cp++ != '\0')
  4305.                     { why = "atime.usec not delimited"; goto screwup; };
  4306.             (void)write(rem, "", 1);
  4307.             continue;
  4308.         }
  4309.         if (*cp != 'C' && *cp != 'D') {
  4310.             
  4311.  
  4312.  
  4313.  
  4314.  
  4315.  
  4316.  
  4317.             if (first) {
  4318.                 error("%s\n", cp);
  4319.                 exit(1);
  4320.             }
  4321.                 { why = "expected control record"; goto screwup; };
  4322.         }
  4323.         mode = 0;
  4324.         for (++cp; cp < buf + 5; cp++) {
  4325.             if (*cp < '0' || *cp > '7')
  4326.                     { why = "bad mode"; goto screwup; };
  4327.             mode = (mode << 3) | (*cp - '0');
  4328.         }
  4329.         if (*cp++ != ' ')
  4330.                 { why = "mode not delimited"; goto screwup; };
  4331.         size = 0;
  4332.         while (     ((_ctype_bits+1)[*cp] & 0x04))
  4333.             size = size * 10 + (*cp++ - '0');
  4334.         if (*cp++ != ' ')
  4335.                 { why = "size not delimited"; goto screwup; };
  4336.         if (targisdir) {
  4337.             static char *namebuf;
  4338.             static int cursize;
  4339.             size_t need;
  4340.  
  4341.             need = strlen(targ) + strlen(cp) + 250;
  4342.             if (need > cursize) {
  4343.                 if (!(namebuf = malloc(need)))
  4344.                     error("out of memory\n");
  4345.             }
  4346.             (void)snprintf(namebuf, need, "%s%s%s", targ,
  4347.                 *targ ? "/" : "", cp);
  4348.             np = namebuf;
  4349.         }
  4350.         else
  4351.             np = targ;
  4352.         exists = stat(np, &stb) == 0;
  4353.         if (buf[0] == 'D') {
  4354.             if (exists) {
  4355.                 if ((stb.st_mode&0170000        ) != 0040000    ) {
  4356.                     errno =     20;
  4357.                     goto bad;
  4358.                 }
  4359.                 if (pflag)
  4360.                     (void)chmod(np, mode);
  4361.             } else if (mkdir(np, mode) < 0)
  4362.                 goto bad;
  4363.             vect[0] = np;
  4364.             sink(1, vect);
  4365.             if (setimes) {
  4366.                 setimes = 0;
  4367.                 if (utimes(np, tv) < 0)
  4368.                     error("rcp: can't set times on %s: %s\n",
  4369.                     np, strerror(errno));
  4370.             }
  4371.             continue;
  4372.         }
  4373.         if ((ofd = open(np, 001        |        01000                , mode)) < 0) {
  4374. bad:            error("rcp: %s: %s\n", np, strerror(errno));
  4375.             continue;
  4376.         }
  4377.         if (exists && pflag)
  4378.             (void)fchmod(ofd, mode);
  4379.         (void)write(rem, "", 1);
  4380.         if ((bp = allocbuf(&buffer, ofd,         4096)) == 0) {
  4381.             (void)close(ofd);
  4382.             continue;
  4383.         }
  4384.         cp = bp->buf;
  4385.         count = 0;
  4386.         wrerr = NO;
  4387.         for (i = 0; i < size; i +=         4096) {
  4388.             amt =         4096;
  4389.             if (i + amt > size)
  4390.                 amt = size - i;
  4391.             count += amt;
  4392.             do {
  4393.                 j = read(rem, cp, amt);
  4394.                 if (j <= 0) {
  4395.                     error("rcp: %s\n",
  4396.                         j ? strerror(errno) :
  4397.                         "dropped connection");
  4398.                     exit(1);
  4399.                 }
  4400.                 amt -= j;
  4401.                 cp += j;
  4402.             } while (amt > 0);
  4403.             if (count == bp->cnt) {
  4404.                 if (wrerr == NO &&
  4405.                     write(ofd, bp->buf, count) != count)
  4406.                     wrerr = YES;
  4407.                 count = 0;
  4408.                 cp = bp->buf;
  4409.             }
  4410.         }
  4411.         if (count != 0 && wrerr == NO &&
  4412.             write(ofd, bp->buf, count) != count)
  4413.             wrerr = YES;
  4414.         if (ftruncate(ofd, size)) {
  4415.             error("rcp: can't truncate %s: %s\n", np,
  4416.                 strerror(errno));
  4417.             wrerr = DISPLAYED;
  4418.         }
  4419.         (void)close(ofd);
  4420.         (void)response();
  4421.         if (setimes && wrerr == NO) {
  4422.             setimes = 0;
  4423.             if (utimes(np, tv) < 0) {
  4424.                 error("rcp: can't set times on %s: %s\n",
  4425.                     np, strerror(errno));
  4426.                 wrerr = DISPLAYED;
  4427.             }
  4428.         }
  4429.         switch(wrerr) {
  4430.         case YES:
  4431.             error("rcp: %s: %s\n", np, strerror(errno));
  4432.             break;
  4433.         case NO:
  4434.             (void)write(rem, "", 1);
  4435.             break;
  4436.         case DISPLAYED:
  4437.             break;
  4438.         }
  4439.     }
  4440. screwup:
  4441.     error("rcp: protocol screwup: %s\n", why);
  4442.     exit(1);
  4443. }
  4444.  
  4445. BUF *
  4446. allocbuf(bp, fd, blksize)
  4447.     BUF *bp;
  4448.     int fd, blksize;
  4449. {
  4450.     struct stat stb;
  4451.     size_t size;
  4452.  
  4453.     if (fstat(fd, &stb) < 0) {
  4454.         error("rcp: fstat: %s\n", strerror(errno));
  4455.         return(0);
  4456.     }
  4457.     size =     ((((stb.st_blksize) + (( blksize) -1))/( blksize))*( blksize));
  4458.     if (size == 0)
  4459.         size = blksize;
  4460.     if (bp->cnt < size) {
  4461.         if (bp->buf != 0)
  4462.             free(bp->buf);
  4463.         bp->buf = malloc(size);
  4464.         if (!bp->buf) {
  4465.             error("rcp: malloc: out of memory\n");
  4466.             return(0);
  4467.         }
  4468.     }
  4469.     bp->cnt = size;
  4470.     return(bp);
  4471. }
  4472.  
  4473.  
  4474. error(fmt, a1, a2, a3)
  4475.     char *fmt;
  4476.     int a1, a2, a3;
  4477. {
  4478.     static FILE *fp;
  4479.  
  4480.     ++errs;
  4481.     if (!fp && !(fp = fdopen(rem, "w")))
  4482.         return;
  4483.     (void)fprintf(fp, "%c", 0x01);
  4484.     (void)fprintf(fp, fmt, a1, a2, a3);
  4485.     (void)fflush(fp);
  4486.     if (!iamremote)
  4487.         (void)fprintf((&stdioErrFile), fmt, a1, a2, a3);
  4488. }
  4489.  
  4490. nospace()
  4491. {
  4492.     (void)fprintf((&stdioErrFile), "rcp: out of memory.\n");
  4493.     exit(1);
  4494. }
  4495.  
  4496.  
  4497. usage()
  4498. {
  4499. # 913 "rcp.c"
  4500.  
  4501.     (void)fprintf((&stdioErrFile),
  4502.         "usage: rcp [-p] f1 f2; or: rcp [-rp] f1 ... fn directory\n");
  4503.  
  4504.     exit(1);
  4505. }
  4506.  
  4507. # 984 "rcp.c"
  4508.  
  4509.